define(".", [ "static_v4/js/minJS/commonPlug/commonPlug.min", "static_v4/js/plug/clipboard/clipboard.min", "static_v4/js/plug/mui/mui", "static_v4/js/plug/idupload/mobileFix.mini", "static_v4/js/plug/idupload/exif", "static_v4/js/plug/idupload/lrz", "static_v4/js/mod/orderDetaail_submit_billing", "static_v4/js/mod/public", "static_v4/js/aes", "static_v4/js/mod/reUpLoad_sea", "static_v4/js/mod/order_detail_sea" ], function(require, exports, module) {
    require("static_v4/js/minJS/commonPlug/commonPlug.min");
    require("static_v4/js/plug/clipboard/clipboard.min");
    // 上传身份证图片插件
    /*require("static_v4/js/minJS/photoClipPlug/photoClipPlug.min");*/
    require("static_v4/js/plug/mui/mui");
    require("static_v4/js/plug/idupload/mobileFix.mini");
    require("static_v4/js/plug/idupload/exif");
    require("static_v4/js/plug/idupload/lrz");
    // 发票弹框代码
    require("static_v4/js/mod/orderDetaail_submit_billing");
    // 暂时不知道为什用到，但貌似是公共包
    require("static_v4/js/aes");
    // 计算总价，用来去除“发票信息展示”；
    // require("static_v4/js/mod/submit_calcLastPrice");
    require("static_v4/js/mod/reUpLoad_sea");
    var orderDetail = require("static_v4/js/mod/order_detail_sea");
    module.exports = {
        init: function() {
            orderDetail.init();
        }
    };
    require.async([ "static_v4/js/plug/mui/mui.zoom", "static_v4/js/plug/mui/mui.viewimage" ], function() {
        var oViewImgBox = $(".js_viewImgBox");
        mui.previewImage(oViewImgBox);
    });
    require.async([ "static_v4/js/mod/iDVerifyPhoto", "static_v4/js/mod/baiduCount" ]);
});
define("static_v4/js/mod/order_detail_sea", [ "./public" ], function(require, exports, module) {
    var myPub = require("./public");
    var oWindow = $(window);
    var oFootBtn = $(".js_footerBtn");
    var oCopyBtn = $(".js_copyBtn");
    // var oCopytext = $('.js_copytext');
    var oBossInfo = $(".js_bossInfo");
    //商家信息 js_bossInfo
    var oBossName = $(".js_bossName");
    //店家名字
    var clipboard = new Clipboard(".js_copyBtn");
    var oLoadInv = $(".js_loadInv");
    var oGoToStoreDom = $(".js_goToStore");
    // 去商家店铺页面的节点
    var oShowNum = $(".js_showNum");
    // 显示手机号码眼睛
    var oPhoneNum = $(".js_phoneNum");
    // 全部手机号码
    var oHidePhoneNUm = $(".js_hidePhoneNUm");
    // 隐藏手机号码
    var nPhoneNum = oPhoneNum.text();
    var nHideNum = nPhoneNum.substr(0, 3) + "****" + nPhoneNum.substr(7, 11);
    var storeDetailUrl = "/m/g/supplier/1.0/isOverSeaSupplier";
    // 判断是进入海外店铺还是进入普通店铺的接口
    var zhichiUrl = "/m/c/m/customer/service/1.0/zhiChiCustomer";
    // 智齿链接
    var supplierNo = supplierId;
    // supplierId
    var imgUrl = $(".js_lazyImg").attr("src");
    module.exports = {
        init: function() {
            orderDetail.orderDetInit(true);
            orderDetail.giftOrderTimerInit();
        }
    };
    // 手机号码隐藏
    oHidePhoneNUm.text(nHideNum);
    oShowNum.hammer().on("tap", function() {
        if ($(this).hasClass("on")) {
            oPhoneNum.hide();
            oHidePhoneNUm.show();
            $(this).removeClass("on icon-eye_look").addClass("icon-eye_close");
        } else {
            oHidePhoneNUm.hide();
            oPhoneNum.show();
            $(this).addClass("on icon-eye_look").removeClass("icon-eye_close");
        }
    });
    // 点击复制
    oCopyBtn.hammer().on("tap", function() {
        // orderDetail.oCopy(oCopytext)
        // myPub.TipLayer('copy Successfully');
        clipboard.on("success", function(e) {
            myPub.TipLayer("复制成功");
        });
        clipboard.on("error", function(e) {
            myPub.TipLayer("复制错误，请稍后重试");
        });
    });
    // 点击下载
    oLoadInv.hammer().on("tap", function() {
        var url_arr = $(this).attr("urls").replace("[", "").replace("]", "").split(",");
        var url = url_arr.pop();
        window.location.href = url;
    });
    oGoToStoreDom.hammer().on("tap", function() {
        var supplierId = $(this).attr("data-supplierId");
        orderDetail.goToStoreDetail(supplierId);
    });
    var orderDetail = {
        orderDetInit: function(bOff) {
            var orderSnNo = orderSn;
            // 订单编号
            var orderFullName = orderName;
            // 收货人名称
            var orderImageId = orderImage;
            // 身份证照
            var orderIndCodeNo = orderIndCode;
            // 身份证号码
            sessionStorage.setItem("orderSnOdd", escape(orderSnNo));
            sessionStorage.setItem("orderNameOdd", escape(orderFullName));
            sessionStorage.setItem("orderImageOdd", escape(orderImageId));
            sessionStorage.setItem("orderIndCodeOdd", escape(orderIndCodeNo));
            orderDetail.btnAskLayer();
        },
        btnAskLayer: function() {
            //    底部的点击事件绑定给底部的大盒子
            //     console.log(oFootBtn);
            oFootBtn.hammer().on("tap", function(e) {
                var _btnA = $(e.gesture.target);
                var _typeNum = _btnA.attr("_type");
                if (_typeNum !== undefined) {
                    myPub.HamstopPropaga();
                }
                var oId = _btnA.attr("oId");
                switch (_typeNum * 1) {
                  //    0 确认送达
                    case 0:
                    var _cont = '<p class="delTipP" >亲！ 确定您已收到货物了吗？</p><span class="delTipSpan">确认收货后平台将会将货款打给商家</span>';
                    myPub.HamstopPropaga();
                    myPub.askLayer(_cont, function() {
                        //确定收货
                        G_JSON_GET("/member/order/receive", {
                            orderId: oId
                        }, function(data) {
                            if (data.status == "success") {
                                //location.reload();
                                // window.location.href = '/shop/goodsComment/comment/'+oId;
                                window.location.href = "/h/goodsafter/applyAppraisal/" + oId + "?picImgUrl=" + imgUrl;
                            } else {
                                myPub.TipLayer(data.message);
                            }
                        });
                        myPub.LayerCloseAll();
                    }, function() {}, "no");
                    break;

                  //  1 申请退款
                    case 1:
                    var _cont = '<p class="delTipP" >确认申请退款吗？</p>';
                    var _this = _btnA;
                    myPub.HamstopPropaga();
                    myPub.askLayer(_cont, function() {
                        // 跳转售后
                        var orderId = _this.attr("oId");
                        window.location.href = "/shop/workOrder/showAfterSales/" + orderId + "?isRefund=true";
                        myPub.LayerCloseAll();
                    }, function() {}, "no");
                    break;

                  //        2 删除订单
                    case 2:
                    var _cont = '<p class="delTipP" >亲！ 您确定要删除此订单吗？</p><span class="delTipSpan">删除后此订单会永远消失</span>';
                    myPub.askLayer(_cont, function() {
                        // 判断删除店家
                        G_JSON_GET("/member/order/delete", {
                            orderId: oId
                        }, function(data) {
                            if (data.status == "success") {
                                window.location.href = "/shop/pay/order_list";
                            } else {
                                myPub.TipLayer(data.message);
                            }
                        });
                        myPub.LayerCloseAll();
                    }, function() {}, "no");
                    break;

                  //        3 评价晒单
                    case 3:
                    window.location.href = "/h/goodsafter/applyAppraisal/" + oId + "?picImgUrl=" + imgUrl;
                    // window.location.href= "/shop/goodsComment/comment/"+oId;
                    //先验证是否已经评价过
                    //                    	G_JSON_GET('/shop/goodsComment/find_comment/'+oId, null, function (data) {
                    //                            if (data.status == "success") {
                    //                            	window.location.href= "/shop/goodsComment/comment/"+oId;
                    //                            } else {
                    //                                myPub.TipLayer(data.message);
                    //                            }
                    //                        });
                    break;

                  //        4 联系商家 
                    case 4:
                    var styleTitle = "width:100%;  border:none";
                    var _sBossInfo = $(".js_bossInfo");
                    var _index = oBossInfo.index(_sBossInfo);
                    var _BossName = oBossName.eq(_index).text();
                    myPub.HamstopPropaga();
                    _sBossInfo.show();
                    myPub.TipTitleLayer("联系商家: " + _BossName, styleTitle, _sBossInfo.html(), function() {
                        _sBossInfo.hide();
                    });
                    break;

                  //        5 先行赔付
                    case 5:
                    var _cont = '<p class="delTipP" >确认申请闪赔吗？</p>';
                    var _this = _btnA;
                    myPub.HamstopPropaga();
                    myPub.askLayer(_cont, function() {
                        // 跳转售后
                        var orderId = _this.attr("oId");
                        window.location.href = "/shop/workOrder/showPreRefund/" + orderId;
                        myPub.LayerCloseAll();
                    }, function() {}, "no");
                    break;

                  //        6 取消订单
                    case 6:
                    myPub.askLayer(orderDetail.cancleCauseHtml(), function() {}, function() {}, "", function() {}, [ "退出", "确认" ]);
                    //改变两个按钮的属性，让“确认”的type为1，让“退出”的type为0
                    $(".layermbtn").find("span").eq(0).attr("type", "1");
                    $(".layermbtn").find("span").eq(1).attr("type", "0");
                    //改变元素的默认样式
                    $(".layermcont").css({
                        padding: "0 1.15rem"
                    });
                    $(".layermbtn").css({
                        height: "3.42rem",
                        "line-height": "3.42rem"
                    });
                    $(".layermbtn").find("span").css({
                        background: "#fff",
                        color: "#838383",
                        "font-size": "1.15rem",
                        height: "100%"
                    });
                    $(".layermbtn").find("span").eq(0).css({
                        "box-sizing": "border-box",
                        "border-right": "1px solid #dedede"
                    });
                    //绑定具体原因的点击事件
                    orderDetail.causeChangeColor();
                    break;

                  //        7 去付款
                    case 7:
                    submitPay(oId);
                    break;

                  //        8 申请售后
                    case 8:
                    var _cont = '<p class="delTipP" >申请售后前请与商家协商好赔付金额?</p>';
                    var _this = _btnA;
                    myPub.HamstopPropaga();
                    myPub.askLayer(_cont, function() {
                        // 跳转售后
                        // var orderId = _this.attr("oId");
                        // window.location.href = '/shop/workOrder/showAfterSales/'+orderId;
                        //联系商家
                        /*if(jswebcallcount != '' && jswebcallcount != null){
                                if(jswebcallcount == 'sfddj'){
                                    window.location.href = "http://sf.365webcall.com/chat/ChatWin3.aspx?settings=mw7mXbNN0m66066mz3Am66066mz3Am66066bz3Am6mmw0&LL=0"+jswebcallparam;
                                }else{
                                    window.location.href = "http://sf.365webcall.com/chat/ChatWinCorp.aspx?email="+jswebcallcount+"&accountid=sfddj&LL=0"+jsorderwebcallparam;
                                }
                                myPub.LayerCloseAll();
                            }*/
                        /*if(settingid != '' && settingid != null){
                                $('#xiaonengA').click();
                                myPub.LayerCloseAll();
                            } else {
                                var styleTitle = 'width:100%;  border:none';
                                var _sBossInfo= $('.js_bossInfo');
                                var _index = oBossInfo.index(_sBossInfo);
                                var _BossName = oBossName.eq(_index).text();

                                myPub.HamstopPropaga();

                                _sBossInfo.show();
                                myPub.TipTitleLayer('联系商家: '+_BossName,styleTitle, _sBossInfo.html(),function() {
                                    _sBossInfo.hide();
                                });
                            }*/
                        orderDetail.concatCustomer();
                    }, function() {
                        //alert('取消了');
                        // 跳转售后
                        var orderId = _this.attr("oId");
                        window.location.href = "/shop/workOrder/showAfterSales/" + orderId;
                        myPub.LayerCloseAll();
                    }, "no", null, [ "联系商家", "申请售后" ]);
                    break;

                  // 送礼订单 分享
                    case 9:
                    window.location.href = "/shop/gift/sharePage/" + oId;
                    break;

                  //        10 发表追评
                    case 10:
                    window.location.href = "/shop/goodsComment/appendComment/" + oId;
                    break;

                  //售后-购物返现以及余额抵扣
                    case 11:
                    var _cont = '<p class="delTipP" >确认申请售后吗?</p>';
                    var _this = _btnA;
                    myPub.HamstopPropaga();
                    myPub.askLayer(_cont, function() {
                        //联系商家
                        /*if(jswebcallcount != '' && jswebcallcount != null){
                                if(jswebcallcount == 'sfddj'){
                                    window.location.href = "http://sf.365webcall.com/chat/ChatWin3.aspx?settings=mw7mXbNN0m66066mz3Am66066mz3Am66066bz3Am6mmw0&LL=0"+jswebcallparam;
                                }else{
                                    window.location.href = "http://sf.365webcall.com/chat/ChatWinCorp.aspx?email="+jswebcallcount+"&accountid=sfddj&LL=0"+jsorderwebcallparam;
                                }
                                myPub.LayerCloseAll();
                            }*/
                        /*if(settingid != '' && settingid != null){
                                $('#xiaonengA').click();
                                myPub.LayerCloseAll();
                            } else {
                                var styleTitle = 'width:100%;  border:none';
                                var _sBossInfo= $('.js_bossInfo');
                                var _index = oBossInfo.index(_sBossInfo);
                                var _BossName = oBossName.eq(_index).text();

                                myPub.HamstopPropaga();

                                _sBossInfo.show();
                                myPub.TipTitleLayer('联系商家: '+_BossName,styleTitle, _sBossInfo.html(),function() {
                                    _sBossInfo.hide();
                                });
                            }*/
                        orderDetail.concatCustomer();
                    }, function() {
                        // 跳转售后
                        var orderId = _this.attr("oId");
                        window.location.href = "/shop/workOrder/showAfterSales/" + orderId;
                        myPub.LayerCloseAll();
                    }, "no", null, [ "联系商家", "申请售后" ]);
                    break;

                  default:
                    ;
                    break;
                }
            });
        },
        concatCustomer: function() {
            G_JSON_GET(zhichiUrl, {
                supplierId: supplierNo
            }, function(data) {
                var dataItem = data.data;
                if (dataItem) {
                    window.location.href = dataItem;
                }
            }, function() {});
        },
        cancleCauseHtml: function() {
            var shtml = "";
            shtml = '<div class="cancleOrderCause js_cancleOrderCause">' + '<div class="cancleReason backWhite">' + '<div class="cancleTit borBEA">' + "<h6>请选择取消原因</h6>" + "</div>" + '<div class="cancleRealReason">' + '<div class="selectReason js_selectReason">' + '<p class="Bflex1">不想买了</p>' + '<p class="Bflex1">拍错/拍多/地址错误</p>' + '<p class="Bflex1">商家缺货</p>' + '<p class="Bflex1">买错了</p>' + '<p class="Bflex1">其他</p>' + "</div>" + '<div class="writeReason">' + '<textarea name="" id="" cols="30" rows="9" placeholder="具体原因（选填）"></textarea>' + "</div>" + "</div>" + "</div>" + "</div>";
            return shtml;
        },
        causeChangeColor: function() {
            $(".js_selectReason p").on("click", function() {
                var index = $(".js_selectReason p").index($(this));
                // console.log(index);
                $(".js_selectReason p").removeClass("active").eq(index).addClass("active");
            });
        },
        // 判断是进入海外店铺还是进入普通店铺的接口
        goToStoreDetail: function(supplierId) {
            var _this = this;
            G_JSON_POST(storeDetailUrl, {
                supplierId: supplierId
            }, function(data) {
                var _data = data.data;
                var _ret = data.ret;
                // console.log('data',_data,_ret);
                if (_ret.code == "0") {
                    if (_data) {
                        // 海外馆商家
                        window.location.href = base + "/h/store/storehome?supplierId=" + supplierId;
                    } else {
                        // 普通商家
                        window.location.href = base + "/h/store/normalStore/" + supplierId;
                    }
                } else {
                    // 如果请求不到就跳转普通商家
                    window.location.href = base + "/h/store/normalStore/" + supplierId;
                }
            });
        },
        // 复制操作
        oCopy: function(obj) {
            obj.select();
            document.execCommand("Copy");
            myPub.TipLayer("复制成功!");
        },
        // 送TA订单 的计时器
        giftOrderTimerInit: function() {
            var _this = this;
            var $giftTimer = $(".jsGiftTimer");
            if ($giftTimer.length <= 0) {
                return;
            }
            if (orderPayTime == null) {
                return;
            }
            var remainSecond = 24 * 3600 - parseInt((new Date().getTime() - orderPayTime) / 1e3);
            var timerText = _this.formatTimer(remainSecond);
            $giftTimer.text(timerText);
            var tempTimerInterval = setInterval(function() {
                remainSecond--;
                var timerText = _this.formatTimer(remainSecond);
                $giftTimer.text(timerText);
                if (remainSecond <= 0) {
                    clearInterval(tempTimerInterval);
                }
            }, 1e3);
        },
        formatTimer: function(timerSecond) {
            var second = timerSecond % 60;
            var min = (timerSecond - timerSecond % 60) / 60 % 60;
            var honr = (timerSecond - timerSecond % 3600) / 3600;
            // console.log("%o  %o  %o  %o",timerSecond,honr,min,second);
            if (honr < 10) {
                honr = "0" + honr;
            }
            if (min < 10) {
                min = "0" + min;
            }
            if (second < 10) {
                second = "0" + second;
            }
            var timerText = honr + ":" + min + ":" + second;
            return timerText;
        }
    };
});
define("static_v4/js/mod/orderDetaail_submit_billing", [ "./public" ], function(require, exports, module) {
    var myPub = require("./public");
    $(function() {
        var oBillingType = $(".js_billingType");
        // 发票类型
        var oText = $(".js_Text");
        // 输入框
        var oBillMobile = $(".js_billMobile");
        // 手机输入框，电子发票的收票人手机号码外层的盒子
        var oBillMail = $(".js_billMail");
        // 邮箱输入框，电子发票的收票人手机号码外层的盒子
        var oBillingHead = $(".js_billingHead");
        // 发票抬头选择
        var oBillingContList = $(".js_billingContList");
        // 普通商品发票内容选择
        var oBillingInfo = $(".js_billingInfo");
        // 收票人信息，收票人的手机和邮箱
        var oSubmitApply = $(".js_submitApply");
        // 提交，点击发票弹窗的‘使用’按钮；
        var oSubmitCancel = $(".js_submitCancel");
        // 点击发票弹窗的‘不使用’按钮
        var oUseBillSide = $(".js_useBillSide");
        // “开票”按钮
        var oDeleteInvoice = $(".js_deleteInvoice");
        // “删除订单”按钮
        var oBillSide = $(".js_billSide");
        // 发票弹框
        var oShadow = $(".js_shadow");
        // 发票弹框顶部的阴影
        var oBllingText = $(".js_billingText");
        // 发票信息展示
        // var $isJifen = $('#isJifen');                // 已经与后台沟通，能不能开票只依照后台返回参数为准，前台不做额外判断，判断是否是积分商品
        // var $oJifen = $('.js_isJifen');             // 已经与后台沟通，能不能开票只依照后台返回参数为准，前台不做额外判断，如果是积分商品，隐藏“发票信息”
        // var $ljkType = $('.ljkType');               // 已经与后台沟通，能不能开票只依照后台返回参数为准，前台不做额外判断，选中礼品卡
        var bSideOff = true;
        // 点击使用和不使用按钮时的节流开关；
        var sType = "[1]";
        // 后台传递发票类型 [0,1],[0],[1], sType 是字符串；已写死；
        var orderSn = oUseBillSide.attr("orderSn");
        // 后台传递当前订单编号
        var moveHeight = oBillSide.outerHeight(true);
        // 发票弹框高度，包含margin ，padding，border；
        var mobile = $(".js_mobile").val();
        // 电子发票的收票人手机号码，手机输入框 input 值，未隐藏处理手机号时先保存完整手机号；
        var pageRefresh = null;
        // 页面自动刷新的倒计时
        // invoice_Status 表示可不可以显示“开票”按钮，如果 invoice_Status 为 true 则显示; 如果 invoice_Status 为 false 则不显示；
        if (!invoice_Status) {
            oDeleteInvoice.show();
            oUseBillSide.hide();
        } else {
            if (orderType != "PREPAICARDSHOP" && isJifen != true) {
                oDeleteInvoice.hide();
                oUseBillSide.show();
            } else {
                oDeleteInvoice.show();
                oUseBillSide.hide();
            }
        }
        oBillSide.css({
            bottom: -moveHeight
        });
        function OnlyBillType(sType) {
            var _Li = oBillingType.find("li");
            // 判断禁止发票类型，如果返回的类型没有这个类型的发票，则除去这个发票选项，原有这个类型添加暗体文字和边框，新需求需要除去整一个的选项dom;
            _Li.each(function(i) {
                if (sType.indexOf(_Li.eq(i).attr("billType")) <= 0) {
                    _Li.eq(i).addClass("unactive");
                    _Li.eq(i).attr("style", "display: none;");
                }
                //  如果只有一个发票类型，因为默认选中的是“普通发票”，所以当只有一个发票类型且发票类型为“电子发票”，则默认发票类型改为“电子发票”
                if (sType.indexOf(_Li.eq(i).attr("billType")) >= 0 && sType.length == 3) {
                    oBillingType.find("li").removeClass("active");
                    $(this).addClass("active");
                    if (_Li.eq(i).attr("billType") == "1") {
                        oBillingInfo.show();
                    }
                }
            });
        }
        //验证地址是否选择
        // function checkAddress() {
        //     var address = $('#province').html();
        //     if (null != address && "" != address) {
        //         return true;
        //     } else {
        //         return false;
        //     }
        // }
        // 发票弹框显示。点击发票信息，如果有填写地址，当点击“发票信息”的时候就显示弹窗且请求当前收货人手机号的公司名称和纳税人识别号，如果有就返回赋值默认显示；
        oUseBillSide.hammer().on("tap", function() {
            // if($ljkType.hasClass('active')){
            //     return;
            // }
            // if(!checkAddress()) {
            //     myPub.TipLayer('请您先填写地址信息！')
            //     return;
            // }
            if (!bSideOff) return;
            bSideOff = false;
            OnlyBillType(sType);
            var companyName = $("#companyName").val();
            var taxpayerCode = $("#taxpayerCode").val();
            if (companyName == null || companyName == "" || taxpayerCode == null || taxpayerCode == "") {
                G_JSON_GET(base + "/m/o/1.0/invoiceInfo/get", {
                    mobile: mobile
                }, function(data) {
                    if (data.ret.code == 0) {
                        $("#companyName").val(data.data.companyName);
                        $("#taxpayerCode").val(data.data.taxCode);
                    }
                });
            }
            // 发票弹框先显示，然后停止所有动画，然后由下往上移动直到 bottom 为 0 即停止，然后弹框阴影显示，然后节流开关打开；同时阻止元素冒泡；
            oBillSide.show().stop().animate({
                bottom: 0
            }, 300, function() {
                oShadow.show();
                bSideOff = true;
            });
            //阻止 hammer 冒泡；
            myPub.HamstopPropaga();
        });
        // 点击弹框阴影关闭发票弹框；
        oShadow.hammer().on("tap", function() {
            //隐藏服务
            HideBillSide();
            myPub.HamstopPropaga();
        });
        // 发票弹框关闭
        function HideBillSide(fn) {
            oBillSide.stop().animate({
                bottom: -moveHeight
            }, 300, function() {
                oBillSide.hide();
                oShadow.hide();
                // $('html').removeClass('bodyHeight100');
                bSideOff = true;
                if (fn) fn();
            });
        }
        // 手机号中间隐藏4位数
        if (oBillMobile.find(".js_mobile").length > 0) {
            HideNum(oBillMobile.find(".js_mobile"));
        }
        // 表格显示和隐藏清除按钮
        oText.on("input propertychange", function() {
            var _val = $(this).val();
            var oClearBtn = $(this).siblings(".js_clearBtn");
            _val == "" ? oClearBtn.hide() : oClearBtn.show();
        });
        // 手机验证
        oBillMobile.find("input").on("input propertychange", function() {
            var _val = $(this).val();
            if (checkPhoneNumber(_val)) {
                oBillMobile.removeClass("has_error").addClass("has_success");
            } else {
                oBillMobile.addClass("has_error").removeClass("has_success");
            }
        });
        //邮箱验证
        oBillMail.find("input").on("input propertychange", function() {
            var _val = $(this).val();
            if (checkMail(_val)) {
                oBillMail.removeClass("has_error").addClass("has_success");
            } else {
                oBillMail.addClass("has_error").removeClass("has_success");
            }
        });
        // 发票类型选择，当是电子发票的时候显示“收票人信息”（收票人电话和邮箱）
        oBillingType.find("li").hammer().on("tap", function() {
            // 判断是否是禁止的
            if ($(this).hasClass("unactive")) return;
            oBillingType.find("li").removeClass("active");
            $(this).addClass("active");
            if ($(this).attr("billType") == "0") {
                oBillingInfo.hide();
            } else {
                oBillingInfo.show();
            }
        });
        // "抬头发票" 个人和公司 选择，如果是选“公司”则显示公司的名称和纳税人识别号；
        oBillingHead.find("li").hammer().on("tap", function() {
            oBillingHead.find("li").removeClass("active");
            $(this).addClass("active");
            if ($(this).attr("billHead") == "company") {
                oBillingHead.find(".js_companyBill").show();
                return;
            }
            oBillingHead.find(".js_companyBill").hide();
        });
        // "普通商品发票内容" 选择，现只存在“明细”一项
        oBillingContList.find("li").hammer().on("tap", function() {
            oBillingContList.find("li").removeClass("active");
            $(this).addClass("active");
        });
        // 如果是“公司发票”则点击使用的时候需要先发送发票数据到这个接口，再随着整张订单发送到后台。如果是“普通发票”则只随着整张订单发送到后台；
        function submitInvoiceInfo(mobile, companyName, taxCode) {
            G_JSON_POST(base + "/m/o/1.0/invoiceInfo/modify", {
                mobile: mobile,
                companyName: companyName,
                taxCode: taxCode
            }, function(date) {});
        }
        //  新增的单独的“电子发票”发送数据
        function submitElectronicInvoice(invoiceData) {
            G_JSON_POST(base + "/m/o/1.0/orderInvoice/patch", invoiceData, function(date) {
                if (date.ret.code == "0" && date.ret.message == "SUCCESS") {
                    myPub.TipLayer("恭喜你，已成功开票！");
                    clearTimeout(pageRefresh);
                    pageRefresh = setTimeout(function() {
                        window.location.href = window.location.href;
                    }, 1e3);
                } else if (date.ret.code == "60040" && date.ret.message == "订单已开过发票") {
                    myPub.TipLayer("该订单已开过发票！");
                }
            });
        }
        // 提交
        oSubmitApply.hammer().on("tap", function() {
            // 发票类型的属性
            var _oBillType = oBillingType.find("li.active").attr("billType");
            //  当前选中的发票类型；
            var itype = $(".js_billingType li.active").attr("value");
            //  发票类型信息
            var ihead = $(".js_billingHead li.active").attr("value");
            //  发票抬头信息
            var icontent = $(".js_billingContList li.active").children("span:eq(1)").html();
            // 普通商品发票内容；
            var companyName = $("#companyName").val();
            // 公司全称；
            var taxCode = $("#taxpayerCode").val();
            // 纳税人识别码；
            var imobile = $("#billMobile").val();
            // 收票人手机号码；
            if (imobile.indexOf("*") > 0) {
                imobile = mobile;
            }
            var iemail = $("#billElectron").val();
            // 普通发票
            if (_oBillType == "0") {
                // 判断当前的发票抬头是“个人发票”还是“公司发票”；
                checkBillHead(function() {
                    // 检测发票内容，目前并没有提供选择项，现只有默认固定的“普通发票内容”；
                    checkContentNull(function() {
                        HideBillSide();
                        oBllingText.text("个人普通发票");
                        var invoice = {
                            itype: parseInt(itype),
                            ihead: parseInt(ihead),
                            icontent: icontent
                        };
                        $("#invoice").val(JSON.stringify(invoice));
                    });
                }, function() {
                    // 如果“发票抬头”为公司，则检测公司名称和纳税人识别号是否存在；
                    checkCompanyInfo(function() {
                        checkContentNull(function() {
                            HideBillSide();
                            oBllingText.text("公司普通发票");
                            var invoice = {
                                itype: parseInt(itype),
                                ihead: parseInt(ihead),
                                icontent: icontent,
                                companyName: companyName,
                                taxCode: taxCode
                            };
                            submitInvoiceInfo(imobile, companyName, taxCode);
                            $("#invoice").val(JSON.stringify(invoice));
                        });
                    });
                });
            } else if (_oBillType == "1") {
                // 电子发票
                checkBillHead(function() {
                    checkContentNull(function() {
                        // 如果是电子发票，则检测电子发票的收票人输入框和邮箱是否为空
                        checkMobileNull(function() {
                            HideBillSide();
                            // oBllingText.text('个人电子发票');
                            var invoice = {
                                orderSn: orderSn,
                                itype: parseInt(itype),
                                ihead: parseInt(ihead),
                                icontent: icontent,
                                imobile: imobile,
                                iemail: iemail
                            };
                            // orderSn: invoiceData.orderSn,
                            // orderId: invoiceData.orderId,    订单 id 没有可以不用传
                            // itype: invoiceData.itype,
                            // ihead: invoiceData.ihead,
                            // icontent: invoiceData.icontent,
                            // imobile: invoiceData.mobile,
                            // companyName: invoiceData.companyName,    公司名称 没有可以不用传
                            // taxCode: invoiceData.taxCode,            公司纳税人识别号 没有可以不用传
                            // iemail: invoiceData.iemail,
                            submitElectronicInvoice(invoice);
                        });
                    });
                }, function() {
                    checkCompanyInfo(function() {
                        checkContentNull(function() {
                            checkMobileNull(function() {
                                HideBillSide();
                                // oBllingText.text('公司电子发票');
                                var invoice = {
                                    orderSn: orderSn,
                                    itype: parseInt(itype),
                                    ihead: parseInt(ihead),
                                    icontent: icontent,
                                    companyName: companyName,
                                    taxCode: taxCode,
                                    imobile: imobile,
                                    iemail: iemail
                                };
                                submitElectronicInvoice(invoice);
                            });
                        });
                    });
                });
            }
        });
        // 不使用发票
        oSubmitCancel.hammer().on("tap", function() {
            HideBillSide();
        });
        // 检测发票抬头类型是 公司还是个人
        function checkBillHead(argPerson, argCompany) {
            // 发票抬头类型
            var _oBillHead = oBillingHead.find("li.active").attr("billHead");
            if (_oBillHead == null || _oBillHead == "") {
                myPub.TipLayer("请选择发票抬头！");
            }
            if (_oBillHead == "person") {
                if (argPerson) argPerson();
            } else if (_oBillHead == "company") {
                if (argCompany) argCompany();
            }
        }
        //检测发票内容
        function checkContentNull(fn) {
            var content = $(".js_billingContList li.active").children("span:eq(1)").html();
            if (content == null || content == "") {
                myPub.TipLayer("请选择发票内容！");
            } else {
                if (fn) fn();
            }
        }
        // 检测“发票抬头”为公司时，公司名和纳税人识别号是否为空， 输入框是否为空
        function checkCompanyInfo(fn) {
            var _oCompanyBillInput = oBillingHead.find(".js_companyBill input");
            if (_oCompanyBillInput.eq(0).val() == "") {
                myPub.TipLayer("请输入您的公司名称！");
            } else if (_oCompanyBillInput.eq(1).val() == "") {
                myPub.TipLayer("请输入纳税人识别码！");
            } else {
                if (fn) fn();
            }
        }
        // 检测电子发票的收票人输入框和邮箱是否为空
        function checkMobileNull(fn) {
            var _mobile = oBillMobile.find("input").val();
            var _email = oBillMail.find("input").val();
            if (_mobile == "") {
                myPub.TipLayer("请输入您的手机号码！");
            } else if (!checkPhoneNumber(_mobile)) {
                myPub.TipLayer("请输入正确的手机号码！");
            } else if (_email == "") {
                myPub.TipLayer("请输入您的邮箱！");
            } else if (!checkMail(_email) && _email != "") {
                myPub.TipLayer("请输入正确的邮箱！");
            } else {
                if (fn) fn();
            }
        }
        // 校验电话号码
        function checkPhoneNumber(v) {
            var regMobile = /^1[3|4|5|7|8]\d{9}$/;
            //验证手机号码
            var regPhone = /^(^0\d{2}-?\d{8}$)|(^0\d{3}-?\d{7}$)|(^\(0\d{2}\)-?\d{8}$)|(^\(0\d{3}\)-?\d{7}$)$/;
            //验证固定电话
            if (regMobile.test(v) || regPhone.test(v) || HidePhone(mobile) == v) {
                return true;
            }
            return false;
        }
    });
    // 校验邮箱
    function checkMail(v) {
        var regMail = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,29})+$/;
        if (regMail.test(v)) {
            return true;
        }
        return false;
    }
    // 隐藏手机中间4位
    function HideNum(obj) {
        var phone = obj.val();
        var mphone = phone.substr(3, 4);
        var lphone = phone.replace(mphone, "****");
        obj.attr("value", lphone);
    }
    function HidePhone(phone) {
        var mphone = phone.substr(3, 4);
        var lphone = phone.replace(mphone, "****");
        return lphone;
    }
});
var baseurl = "";

var smallImgArg = "?x-oss-process=style/goods_img_3";

var smallImgArg300 = "?x-oss-process=style/goods_img_2";

var smallImgArg200 = "?x-oss-process=style/goods_img";

function check_support_webp() {
    var isSupportWebp = document.createElement("canvas").toDataURL("image/webp").indexOf("data:image/webp") == 0;
    return isSupportWebp;
}

if (check_support_webp()) {
    smallImgArg = "?x-oss-process=style/goods_webp_3";
    smallImgArg300 = "?x-oss-process=style/goods_webp_2";
    smallImgArg200 = "?x-oss-process=style/goods_webp";
}

define("static_v4/js/mod/public", [], function(require, exports, module) {
    //yx
    //var httpImageUrl="https://fm95338bucket.oss-cn-shenzhen.aliyuncs.com/";
    //zs
    //var httpImageUrl="https://sfddj-img-bucket.oss-cn-shenzhen.aliyuncs.com/";
    var httpImageUrl;
    var myDoMain = "";
    if (window.location.host == "m.sfddj.com" || window.location.host == "120.76.47.184" || window.location.host == "120.76.207.85" || window.location.host == "120.76.44.28") {
        // httpImageUrl="https://sfddj-img-bucket.oss-cn-shenzhen.aliyuncs.com/";
        httpImageUrl = "https://img.sfddj.com/";
        myDoMain = "https://m.sfddj.com";
    } else if (window.location.host == "hdm.sfddj.com") {
        httpImageUrl = "https://img.sfddj.com/";
        myDoMain = "https://hdm.sfddj.com";
    } else if (window.location.host == "itsm.sfddj.com") {
        // httpImageUrl="https://fm95338bucket.oss-cn-shenzhen.aliyuncs.com/";
        httpImageUrl = "https://img.fx-sf.com/";
        myDoMain = "https://itsm.sfddj.com";
    } else if (window.location.host == "shop.fx-sf.com") {
        // httpImageUrl="https://fm95338bucket.oss-cn-shenzhen.aliyuncs.com/";
        httpImageUrl = "https://img.fx-sf.com/";
        myDoMain = "https://shop.fx-sf.com";
    } else if (window.location.host == "www.shhyxypsx.com") {
        httpImageUrl = "https://img.fx-sf.com/";
        myDoMain = "https://www.shhyxypsx.com";
    } else if (window.location.hostname == "localhost") {
        httpImageUrl = "http://img-dev.sfddj.com/";
        myDoMain = "http://localhost:8082";
    }
    exports.httpImageUrl = httpImageUrl;
    exports.myDoMain = myDoMain;
    //加入购物车的动画
    function AddCarAnimate(_X, _Y, target, sLeft, sTop, offsetDis, callBack) {
        // var _X = e.gesture.center.x;
        // var _Y = e.gesture.center.y;
        var time = null;
        var timeTwo = null;
        target.removeClass("myRotateFast");
        target.css({
            left: _X,
            top: _Y,
            opacity: 1
        });
        clearTimeout(time);
        time = setTimeout(function() {
            target.addClass("myRotateFast").stop().animate({
                left: _X,
                top: _Y - 50,
                opacity: 1
            }, 300, function() {
                target.stop().animate({
                    left: sLeft,
                    top: sTop
                }, 600, function() {
                    target.removeClass("myRotateFast");
                    clearTimeout(timeTwo);
                    timeTwo = setTimeout(function() {
                        target.stop().animate({
                            top: sTop + offsetDis * 2,
                            opacity: 0
                        }, 200, function() {
                            if (callBack) callBack();
                        });
                    }, 200);
                });
            });
        }, 30);
    }
    exports.AddCarAnimate = AddCarAnimate;
    // hammer 冒泡
    function HamstopPropaga() {
        window.event.returnValue = false;
        return false;
    }
    exports.HamstopPropaga = HamstopPropaga;
    //hammer事件
    function HammerEvent(obj) {
        this.obj = obj;
    }
    HammerEvent.prototype.addHamEvent = function(obj, type, fn) {
        this.obj = new Hammer.Manager(obj);
        this.obj.add(new Hammer.Pan({
            velocity: 0,
            threshold: 120,
            direction: Hammer.DIRECTION_ALL
        }));
        //平滑
        this.obj.add(new Hammer.Swipe({
            threshold: 8,
            direction: Hammer.DIRECTION_ALL
        }));
        this.obj.add(new Hammer.Tap({}));
        this.obj.add(new Hammer.Press({
            velocity: .6,
            threshold: 8
        }));
        //长时间下压
        this.obj.off(type);
        this.obj.on(type, function(e) {
            if (fn) fn(e);
        });
    };
    exports.HammerEvent = HammerEvent;
    /* 数字验证 */
    function ValiNum(obj, fn1, fn2) {
        var reg = new RegExp("^[0-9]*$");
        if (!reg.test(obj.val())) {
            if (fn1) fn1();
        } else if (obj.val() <= 0) {
            // TipLayer("数量不能小余1");
            obj.val(1);
        } else {
            if (fn2) fn2();
        }
    }
    exports.ValiNum = ValiNum;
    /* 字数统计 */
    function statInputNum(textArea, numItem) {
        var max = [];
        var curLength = [];
        textArea.each(function(i) {
            max[i] = parseInt(numItem.eq(i).text());
            if (textArea.eq(i).val().length > 0) {
                curLength[i] = textArea.eq(i).val().length;
                numItem.eq(i).empty().text(max[i] - curLength[i]);
            }
            textArea.eq(i).attr("maxlength", max[i]).on("input propertychange", function() {
                curLength[i] = $(this).val().length;
                numItem.eq(i).empty().text(max[i] - curLength[i]);
            });
        });
    }
    exports.statInputNum = statInputNum;
    /* 购物车价格统计 */
    function ShopSumPrice(obj, tarFather, target, sumPrice) {
        var _price = 0;
        obj.each(function(i) {
            if (obj.eq(i).hasClass("active")) {
                var _oGoodsPrice = obj.eq(i).parents(tarFather).find(target);
                _oGoodsPrice.each(function(i) {
                    _price += _oGoodsPrice.eq(i).text() * 1;
                    return _price;
                });
            }
        });
        sumPrice.text(_price.toFixed(2));
    }
    exports.ShopSumPrice = ShopSumPrice;
    /*************** 弹框效果 s***************/
    //提示框
    function TipLayer(sCont, sStyle, fn, T) {
        layer.open({
            content: sCont,
            style: sStyle != "no" ? sStyle : "background-color:rgba(255,255,255,1); color:#252525; border:none; border-radius: 5px;",
            scrollbar: false,
            time: T || 2,
            shadeClose: false,
            success: function() {
                if (fn) fn();
            }
        });
        NoTouchMove($(".laymshade"));
    }
    exports.TipLayer = TipLayer;
    //提示框_没有遮罩层
    function TipLayer_noShade(sCont, sStyle, fn, T) {
        layer.open({
            content: sCont,
            style: sStyle != "no" ? sStyle : "background-color:rgba(255,255,255,1); color:#252525; border:none; border-radius: 5px;",
            scrollbar: false,
            time: T || 2,
            shade: false,
            shadeClose: false,
            success: function() {
                if (fn) fn();
            }
        });
        NoTouchMove($(".laymshade"));
    }
    exports.TipLayer_noShade = TipLayer_noShade;
    //框消失后执行回调提示框
    function TipLayerEnd(sCont, sStyle, fn, T) {
        layer.open({
            content: sCont,
            style: sStyle != "no" ? sStyle : "background-color:rgba(255,255,255,1); color:#252525; border:none; border-radius: 5px;",
            scrollbar: false,
            time: T || 2,
            shadeClose: false,
            end: function() {
                if (fn) fn();
            }
        });
        NoTouchMove($(".laymshade"));
    }
    exports.TipLayerEnd = TipLayerEnd;
    // 用户手动关闭弹框
    function TipLayerLong(sCont, sStyle) {
        layer.open({
            content: sCont,
            style: sStyle != "no" ? sStyle : "background-color:rgba(255,255,255,1); color:#252525; border:none; border-radius: 5px;",
            scrollbar: false,
            shadeClose: true
        });
        NoTouchMove($(".laymshade"));
    }
    exports.TipLayerLong = TipLayerLong;
    // 用户手动关闭弹框有关闭按钮
    function TipLayerLongClose(sTit, sCont, sStyle, fn) {
        layer.open({
            title: sTit != "no" ? sTit : "",
            content: sCont,
            style: sStyle != "no" ? sStyle : "background-color:rgba(255,255,255,1); color:#252525; border:none; border-radius: 5px;",
            scrollbar: false,
            shadeClose: true,
            closeBtn: 1,
            success: function() {
                if (fn) fn();
            }
        });
        NoTouchMove($(".laymshade"));
    }
    exports.TipLayerLongClose = TipLayerLongClose;
    //带按钮提示框
    function TipBtnLayer(sCont, sTit, btnName, yesFn, cancelFn, fn) {
        layer.open({
            title: sTit != "no" ? sTit : "",
            content: sCont,
            btn: btnName == undefined ? [ "确定" ] : [ btnName ],
            shadeClose: false,
            scrollbar: false,
            yes: function() {
                if (yesFn) yesFn();
                LayerCloseAll();
            },
            cancel: function() {
                if (cancelFn) cancelFn();
            },
            success: function() {
                if (fn) fn();
                $(".layermbtn span").css({
                    width: "100%"
                });
            }
        });
        NoTouchMove($(".laymshade"));
    }
    exports.TipBtnLayer = TipBtnLayer;
    // 标题提示框
    function TipTitleLayer(sTitle, styleTit, sCont, fn) {
        layer.open({
            title: [ sTitle, "background-color:#fff; color:#666; font-weight:bold" ],
            content: sCont,
            shadeClose: false,
            scrollbar: false,
            style: styleTit,
            cancel: function() {
                if (fn) fn();
            }
        });
        NoTouchMove($(".laymshade"));
    }
    exports.TipTitleLayer = TipTitleLayer;
    //询问层
    function askLayer(sCont, yesFn, noFn, sTit, callBack, aBtnName) {
        layer.open({
            //no 为没有标题 sTit为设置标题
            title: sTit != "no" ? sTit : "",
            content: sCont,
            btn: aBtnName == undefined ? [ "确认", "取消" ] : aBtnName,
            shadeClose: false,
            scrollbar: false,
            yes: yesFn,
            no: noFn,
            cancel: noFn,
            success: function() {
                if (callBack) callBack();
            }
        });
        NoTouchMove($(".laymshade"));
    }
    exports.askLayer = askLayer;
    // 关闭所有弹框
    function LayerCloseAll() {
        layer.closeAll();
    }
    exports.LayerCloseAll = LayerCloseAll;
    //加载层
    function loadLayer(cont) {
        layer.open({
            type: 2,
            content: cont,
            shadeClose: false
        });
        NoTouchMove($(".laymshade"));
    }
    exports.loadLayer = loadLayer;
    //防止滑动
    function NoTouchMove(obj) {
        obj.on("touchmove", function() {
            return false;
        });
    }
    exports.NoTouchMove = NoTouchMove;
    /*************** 弹框效果 e***************/
    //节流控制
    function throttle(method, context, time) {
        time == undefined ? time = 200 : time = time;
        //console.log(time)
        clearTimeout(method.tId);
        method.tId = setTimeout(function() {
            method.call(context);
        }, time);
    }
    exports.throttle = throttle;
    //s20是代表20秒 h是指小时，如12小时则是：h12 d是天数，30天则：d30
    //写cookies setCookie("name","hayden",'s20');
    function setCookie(name, value, time) {
        var strsec;
        if (time == undefined) {
            var Days = 30;
            //默认30天有效期
            strsec = Days * 24 * 60 * 60 * 1e3;
        } else {
            strsec = getsec(time) * 1;
        }
        var exp = new Date();
        exp.setTime(exp.getTime() + strsec);
        document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString() + ";path=/";
    }
    exports.setCookie = setCookie;
    //读取cookies getCookie("name")
    function getCookie(name) {
        var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
        if (arr = document.cookie.match(reg)) {
            return unescape(arr[2]);
        } else {
            return null;
        }
    }
    exports.getCookie = getCookie;
    //删除cookies delCookie('name')
    function delCookie(name) {
        var exp = new Date();
        exp.setTime(exp.getTime() - 1);
        var cval = getCookie(name);
        if (cval != null) document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString() + ";path=/";
    }
    exports.delCookie = delCookie;
    //设置cookie时间
    function getsec(str) {
        var str1 = str.substring(1, str.length) * 1;
        var str2 = str.substring(0, 1);
        if (str2 == "s") {
            return str1 * 1e3;
        } else if (str2 == "h") {
            return str1 * 60 * 60 * 1e3;
        } else if (str2 == "d") {
            return str1 * 24 * 60 * 60 * 1e3;
        }
    }
    /* 验证码倒计时 */
    function CutTime(time, fn1, fn2) {
        var _AllTime = time;
        var _T = null;
        clearInterval(_T);
        _T = setInterval(function() {
            if (time <= 0) {
                clearInterval(_T);
                if (fn1) fn1(_AllTime);
            } else {
                time--;
                if (fn2) fn2(time);
            }
        }, 1e3);
    }
    exports.CutTime = CutTime;
    /*手机号码验证*/
    function checkMobile(obj, fn1, fn2, fn3) {
        var oIphone = obj.val();
        var reg = /^(1[1|2|3|4|5|6|7|8|9])[\d]{9}$/;
        //验证手机号码
        if (oIphone == "") {
            if (fn1) fn1();
        } else if (!reg.test(oIphone)) {
            if (fn2) fn2();
        } else {
            if (fn3) fn3();
        }
    }
    exports.checkMobile = checkMobile;
    /*密码验证*/
    function checkPassWord(obj, fn1, fn2, fn3) {
        var _val = obj.val();
        var reg = /^[a-zA-Z0-9]{6,20}$/;
        //6-20位数字和英文
        if (_val == "") {
            if (fn1) fn1();
        } else if (!reg.test(_val)) {
            if (fn2) fn2();
        } else {
            if (fn3) fn3();
        }
    }
    exports.checkPassWord = checkPassWord;
    /*用户名验证*/
    function checkUserName(obj, fn1, fn2, fn3) {
        var _userName = obj.val();
        var reg = /^[A-Za-z\u4e00-\u9fa5][A-Za-z0-9\u4e00-\u9fa5]{1,9}$/;
        //验证用户名
        if (_userName == "") {
            if (fn1) fn1();
        } else if (!reg.test(_userName)) {
            if (fn2) fn2();
        } else {
            if (fn3) fn3();
        }
    }
    exports.checkUserName = checkUserName;
    //图片预加载(window)
    function lazLoadingImgEcho(obj, fn) {
        echo.init({
            container: obj,
            offset: 300,
            throttle: 50,
            //设置图片延迟加载的时间 
            callback: function(element, op) {
                if (fn) fn(element, op);
                // console.log(element, 'has been', op + 'ed')
                var $el = $(element);
                var sUl = $el.attr("src");
                loadImageCheck(sUl, function() {
                    $el.addClass("fadeIn");
                    $el = null;
                });
            }
        });
    }
    exports.lazLoadingImgEcho = lazLoadingImgEcho;
    function lazLoadingImg(obj) {
        this.obj = obj;
    }
    //添加图片预加载
    lazLoadingImg.prototype.AddLazLoadingImg = function(obj, fn) {
        this.obj = echoChangeByCc.initNew({
            container: obj,
            unload: false,
            offset: 300,
            throttle: 80,
            //设置图片延迟加载的时间
            callback: function(element, op) {
                var $el = $(element);
                var sUl = $el.attr("src");
                loadImageCheck(sUl, function() {
                    $el.addClass("fadeIn");
                    $el = null;
                });
                if (fn) fn();
            }
        });
    };
    // 图片预加载 销毁
    lazLoadingImg.prototype.DestroyLazLoadingImg = function() {
        var _this = this.obj;
        if (_this && _this.detach) {
            _this.detach();
        }
    };
    // 图片预加载 刷新
    lazLoadingImg.prototype.RushLazLoadingImg = function() {
        var _this = this.obj;
        _this.render();
    };
    function loadImageCheck(url, callback) {
        //创建一个Image对象，实现图片的预下载
        var img = new Image();
        img.src = url;
        // 如果图片已经存在于浏览器缓存，直接调用回调函数
        if (img.complete) {
            callback();
            img = null;
            return;
        }
        img.onload = function() {
            //图片下载完毕时异步调用callback函数。
            callback();
            img = null;
        };
    }
    exports.lazLoadingImg = lazLoadingImg;
    function lazLoadingImgEchoAbs(obj, fn) {
        echoChangeByCc.initNew({
            container: obj,
            unload: false,
            offset: 200,
            throttle: 30,
            //设置图片延迟加载的时间
            callback: function(element, op) {
                var $el = $(element);
                // console.log($el)
                var sUl = $el.attr("src");
                loadImageCheck(sUl, function() {
                    $el.addClass("fadeIn");
                    $el = null;
                });
                if (fn) fn();
            }
        });
    }
    exports.lazLoadingImgEchoAbs = lazLoadingImgEchoAbs;
    //mui插件事件开关
    function OffMuiEvent(arg) {
        mui.init({
            gestureConfig: {
                tap: arg,
                //默认为true
                swipe: arg
            }
        });
    }
    exports.OffMuiEvent = OffMuiEvent;
    //设置li图片高度 父级获取
    function SetImgHeight(obj, getWidth) {
        var htmlFontSize = $("html").css("font-size");
        var intSize = htmlFontSize.split("p")[0];
        var imgWidth = null;
        if (obj[0].nodeName.toLowerCase() === "li") {
            getWidth ? imgWidth = getWidth / intSize : imgWidth = obj.find("figure").eq(0).parents("a").width() / intSize;
            // obj.find('figure:not(:first)').css({'height': imgWidth+'rem', 'width': imgWidth+'rem'});
            obj.find("figure").css({
                height: imgWidth + "rem",
                width: imgWidth + "rem"
            });
        } else {
            getWidth ? imgWidth = getWidth / intSize : imgWidth = obj.find("li figure").eq(0).parents("a").width() / intSize;
            // obj.find('li figure:not(:first)').css({'height': imgWidth+'rem', 'width': imgWidth+'rem'});
            obj.find("li figure").css({
                height: imgWidth + "rem",
                width: imgWidth + "rem"
            });
        }
    }
    exports.SetImgHeight = SetImgHeight;
    // 日期 2015-09-01 11:16:00
    function FormatDateTime(date, minType, point) {
        var y = date.getFullYear();
        var m = date.getMonth() + 1;
        m = m < 10 ? "0" + m : m;
        var d = date.getDate();
        d = d < 10 ? "0" + d : d;
        var h = date.getHours();
        h = h < 10 ? "0" + h : h;
        var minute = date.getMinutes();
        minute = minute < 10 ? "0" + minute : minute;
        var seconds = date.getSeconds();
        seconds = seconds < 10 ? "0" + seconds : seconds;
        var _sep = "-";
        if (point) _sep = point;
        // 最小到天
        if (minType == "minDay") {
            return y + _sep + m + _sep + d;
        } else if (minType == "minMinute") {
            return y + _sep + m + _sep + d + " " + h + ":" + minute;
        } else {
            return y + _sep + m + _sep + d + " " + h + ":" + minute + ":" + seconds;
        }
    }
    exports.FormatDateTime = FormatDateTime;
    /*************** 滚动条效果 s***************/
    function ScrollBar(obj) {
        this.obj = obj;
    }
    //添加滚动条
    ScrollBar.prototype.AddScroll = function(obj, sOptions) {
        this.obj = new JRoll(obj, sOptions);
    };
    //刷新滚动条
    ScrollBar.prototype.ReScroll = function(fn) {
        var _this = this.obj;
        _this.refresh();
        if (fn) fn();
    };
    //删除滚动条
    ScrollBar.prototype.DelScroll = function(fn) {
        var _this = this.obj;
        _this.destroy();
        if (fn) fn();
    };
    //滚动 到 0
    ScrollBar.prototype.ScrollTo = function(x, y, time, fn) {
        var _this = this.obj;
        _this.scrollTo(x, y, time, false, function() {
            if (fn) fn(_this);
        });
    };
    //滚动开始事件
    ScrollBar.prototype.ScrollStart = function(fn) {
        var _this = this.obj;
        _this.on("scrollStart", fn);
    };
    //滚动结束事件
    ScrollBar.prototype.ScrollEnd = function(fn1, fn2) {
        var _this = this.obj;
        _this.on("scrollEnd", fn1);
        if (fn2) fn2();
    };
    //滚动监听
    ScrollBar.prototype.ScrollIng = function(fn) {
        var _this = this.obj;
        //this.obj.on('scroll', fn);
        this.obj.on("scroll", function() {
            if (fn) fn(_this);
        });
    };
    //滚动下拉刷新
    ScrollBar.prototype.ScrollPullDown = function(sOptions) {
        var _this = this.obj;
        _this.pulldown(sOptions);
    };
    exports.ScrollBar = ScrollBar;
    function getFontSize() {
        var doc = document, win = window;
        var docEl = doc.documentElement, resizeEvt = "orientationchange" in window ? "orientationchange" : "resize", recalc = function() {
            var clientWidth = docEl.clientWidth;
            if (!clientWidth) return;
            //如果屏幕大于750（750是根据我效果图设置的，具体数值参考效果图），就设置clientWidth=750，防止font-size会超过100px
            if (clientWidth > 750) {
                clientWidth = 750;
            }
            //设置根元素font-size大小
            docEl.style.fontSize = 100 * (clientWidth / 750) + "px";
        };
        //屏幕大小改变，或者横竖屏切换时，触发函数
        win.addEventListener(resizeEvt, recalc, false);
        //文档加载完成时，触发函数
        // doc.addEventListener('DOMContentLoaded', recalc, false);
        $(doc).ready(function() {
            recalc();
        });
    }
    exports.getFontSize = getFontSize;
    function getGoodsNo(url) {
        var reg = new RegExp("^YW[a-zA-Z0-9]{12,14}$");
        var aUrl = "";
        if (!url) return;
        if (url.indexOf("/") > -1) {
            aUrl = url.substr(0).split("/");
            for (var i = 0; i < aUrl.length; i++) {
                if (checkField(aUrl[i])) {
                    return checkField(aUrl[i]);
                } else if (checkField(aUrl[i]) == undefined) {
                    return false;
                }
            }
        } else {
            if (checkField(url)) {
                return checkField(url);
            } else if (checkField(url) == undefined) {
                return false;
            }
        }
        function checkField(_url) {
            var _aUrl = "";
            if (_url.length >= 14) {
                if (_url.indexOf("?") > 0) {
                    _aUrl = _url.split("?");
                    for (var i = 0; i < _aUrl.length; i++) {
                        if (reg.test(_aUrl[i])) {
                            return _aUrl[i];
                        }
                    }
                } else {
                    if (reg.test(_url)) {
                        return _url;
                    } else {
                        return false;
                    }
                }
            } else {
                return false;
            }
        }
    }
    exports.getGoodsNo = getGoodsNo;
    // 检测 安卓 ios 分享 大当家 链接跳转
    function JudgeAppHref(obj, oldH5) {
        var _href = "";
        var _Num = 0;
        var u = navigator.userAgent;
        //var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
        var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
        //ios终端
        // 返回首页操作
        var hrefToHome = [ "/", "sf://" ];
        var hrefName = [ "/h/goodspay/goodsView/", "sf://goodsDetail?goodsSn=" ];
        var sLocationArg = window.location.search.split("?")[1];
        var fxBtn = false;
        if (sLocationArg !== undefined) {
            if (sLocationArg.search("sell_member_id") > -1) {
                fxBtn = true;
            }
        }
        // 检测室安卓还是ios
        if (u.search("origin/sfddjapp") > 0) {
            if (isIOS) {
                _Num = 1;
                obj.each(function(i) {
                    _href = obj.eq(i).attr("_href");
                    // 检测回到首页
                    if (_href === "home") {
                        obj.eq(i).attr("href", hrefToHome[_Num] + _href);
                    } else {
                        if (getGoodsNo(_href)) {
                            obj.eq(i).attr("href", hrefName[_Num] + getGoodsNo(_href));
                        } else {
                            obj.eq(i).attr("href", _href);
                        }
                    }
                });
            } else {
                obj.each(function(i) {
                    // 检测回到首页
                    _href = obj.eq(i).attr("_href");
                    if (_href === "home") {
                        AndroidReHome(obj.eq(i));
                    } else {
                        if (getGoodsNo(_href)) {
                            //要去掉a标签自带的href属性，因为这个跳转比点击事件要快，如果有这个属性在安卓上会跳转两次
                            obj.eq(i).removeAttr("href");
                            AndroidGoods(obj.eq(i), getGoodsNo(_href));
                        } else {
                            obj.eq(i).attr("href", _href);
                        }
                    }
                });
            }
        } else if (window.__wxjs_environment === "miniprogram") {
            obj.each(function(i) {
                // 如果有_href 这个自定义属性，_href 只有等于 home 或者 商品编号，就回到小程序页面；
                _href = obj.eq(i).attr("_href");
                if (_href) {
                    // 禁用掉 href
                    // obj.eq(i).attr("href", "javascript:void(0);");
                    obj.eq(i).removeAttr("href");
                    // 检测回到首页
                    if (_href === "home") {
                        minAppEven(obj.eq(i));
                    } else {
                        if (getGoodsNo(_href)) {
                            minAppEven(obj.eq(i), getGoodsNo(_href));
                        } else if (isDrawCouponLink(_href)) {
                            minAppEven(obj.eq(i), false, "/pages/home/drawCoupon/drawCoupon?ruleSign=" + isDrawCouponLink(_href));
                        } else {
                            obj.eq(i).attr("href", _href);
                        }
                    }
                }
            });
        } else if (fxBtn) {
            _Num = 0;
            obj.each(function(i) {
                _href = obj.eq(i).attr("_href");
                if (_href === "home") {
                    obj.eq(i).attr("href", hrefToHome[_Num] + _href);
                } else {
                    if (getGoodsNo(_href)) {
                        obj.eq(i).attr("href", hrefName[_Num] + getGoodsNo(_href) + "?" + sLocationArg);
                    } else {
                        obj.eq(i).attr("href", _href + "?" + sLocationArg);
                    }
                }
            });
        } else {
            _Num = 0;
            obj.each(function(i) {
                _href = obj.eq(i).attr("_href");
                var appendData = _href.indexOf("?") > -1 ? "?" + _href.split("?")[1] : "";
                if (_href === "home") {
                    obj.eq(i).attr("href", hrefToHome[_Num] + _href);
                } else {
                    if (getGoodsNo(_href)) {
                        if (oldH5 === "oldH5") {
                            obj.eq(i).attr("href", "/shop/goods/view/" + getGoodsNo(_href) + appendData);
                        } else {
                            obj.eq(i).attr("href", hrefName[_Num] + getGoodsNo(_href) + appendData);
                        }
                    } else {
                        obj.eq(i).attr("href", _href);
                    }
                }
            });
        }
    }
    exports.JudgeAppHref = JudgeAppHref;
    //判断是否是h5的领券页
    function isDrawCouponLink(url) {
        // var  reg = new RegExp("^YW[a-zA-Z0-9]{12,14}$");
        var ruleSignStr = "";
        if (!url) return false;
        if (url.indexOf("/coupon/drawCoupon") > -1) {
            ruleSignStr = url.split("ruleSign=")[1];
            if (ruleSignStr.indexOf("&") > -1) {
                var ruleSign = ruleSignStr.split("&")[0];
                return ruleSign;
            } else {
                return ruleSignStr;
            }
        } else {
            return false;
        }
    }
    exports.isDrawCouponLink = isDrawCouponLink;
    // 小程序事件处理
    function minAppEven(obj, arg, url) {
        obj.off("click");
        obj.on("click", function() {
            // console.log(arg)
            // 小程序物品详情
            if (arg) {
                wx.miniProgram.navigateTo({
                    url: "/pages/shopping/goodsDetail/goodsDetail?goodsSn=" + arg
                });
            } else if (url) {
                wx.miniProgram.navigateTo({
                    url: url
                });
            } else {
                wx.miniProgram.switchTab({
                    url: "/pages/home/home"
                });
            }
        });
    }
    // 安卓绑定点击事件
    function AndroidGoods(obj, arg) {
        obj.off("click");
        obj.on("click", function() {
            android.goodsDetail(arg);
        });
    }
    // 安卓绑定点击返回首页
    function AndroidReHome(obj) {
        obj.off("click");
        obj.on("click", function() {
            android.toMainAcivity();
        });
    }
    function removeArrayChildren(arr, val) {
        var index = arr.indexOf(val);
        if (index > -1) {
            arr.splice(index, 1);
        }
    }
    exports.removeArrayChildren = removeArrayChildren;
    // 弹框获取焦点后 页面高度调整
    function setFocusBodyScrollTop(timer, fn) {
        var cnt = 0;
        var oBody = $("body");
        timer = setInterval(function() {
            if (cnt < 3) {
                cnt++;
            } else {
                clearInterval(timer);
                timer = null;
                return;
            }
            oBody[0].scrollTop = oBody[0].scrollHeight;
            if (fn) fn();
        }, 300);
    }
    exports.setFocusBodyScrollTop = setFocusBodyScrollTop;
    function locationHref(href) {
        $("body").append($('<a href="' + href + '"><span id="locationHrefId"><span><a>'));
        $("#locationHrefId").click();
    }
    exports.locationHref = locationHref;
    // 检测 安卓 ios 隐藏指定对象
    function JudgeAppHide(ios, and, h5) {
        var u = navigator.userAgent;
        //var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
        var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
        //ios终端
        // 检测室安卓还是ios
        if (u.search("origin/sfddjapp") > 0) {
            if (isIOS) {
                if (ios) ios();
            } else {
                if (and) and();
            }
        } else {
            if (h5) h5();
        }
    }
    exports.JudgeAppHide = JudgeAppHide;
    function isIphoneXsMinX() {
        return /iphone/gi.test(navigator.userAgent) && screen.height == 812 && screen.width == 375;
    }
    exports.isIphoneXsMinX = isIphoneXsMinX;
    function isIphoneXRXSMax() {
        return /iphone/gi.test(navigator.userAgent) && screen.height == 896 && screen.width == 414;
    }
    exports.isIphoneXRXSMax = isIphoneXRXSMax;
    /**
     * 判断是否是微信浏览器
     * @returns {Boolean}
     */
    function isWeiXin() {
        var ua = window.navigator.userAgent.toLowerCase();
        if (ua.match(/MicroMessenger/i) == "micromessenger") {
            return true;
        } else {
            return false;
        }
    }
    exports.isWeiXin = isWeiXin;
    /**
     * 判断是否是支付宝浏览器
     * @returns {boolean}
     */
    function isAlipayClient() {
        var ua = window.navigator.userAgent.toLowerCase();
        if (ua.match(/AlipayClient/i) == "alipayclient") {
            return true;
        } else {
            return false;
        }
    }
    exports.isAlipayClient = isAlipayClient;
    /**
     * 判断是否是QQ内置浏览器
     * @returns {boolean}
     */
    function isQQClient() {
        var ua = window.navigator.userAgent.toLowerCase();
        if (ua.match(/QQ/i) == "qq") {
            return true;
        } else {
            return false;
        }
    }
    exports.isQQClient = isQQClient;
    //XSS 前端过滤
    function XssCheck(str, reg) {
        return str ? str.replace(reg || /[&<">'](?:(amp|lt|quot|gt|#39|nbsp|#\d+);)?/g, function(a, b) {
            if (b) {
                return a;
            } else {
                return {
                    "<": "&lt;",
                    "&": "&amp;",
                    '"': "&quot;",
                    ">": "&gt;",
                    "'": ""
                }[a];
            }
        }) : "";
    }
    exports.XssCheck = XssCheck;
    /*
    * 判断用户是否安装app,已安装就跳app,未安装就正常跳h5页面
    * 因可能有安卓跳A页面，ios跳B页面的情况，所以两种终端的url分开写
    * androidUrl, iosUrl是跳的指定页面  比如'https://m.sfddj.com/coupon/toCouponCenter'
    * 如果没有指定页面(首页)就不填写或者填写空'' 如isHasApp('','',function(){})或者isHasApp()
    * */
    function isHasApp(androidUrl, iosUrl, fn) {
        var u = navigator.userAgent;
        var isAndroid = u.indexOf("Android") > -1 || u.indexOf("Linux") > -1;
        //android终端或者uc浏览器
        var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
        //ios终端
        if (u.search("origin/sfddjapp") == -1) {
            if (isAndroid) {
                // 在安卓的终端
                var HrefUrl = "";
                if (androidUrl && androidUrl != undefined && androidUrl != "") {
                    HrefUrl = "ddjapp://cn.dankal.sf/webpage?url=" + androidUrl;
                } else {
                    HrefUrl = "ddjapp://cn.dankal.sf/android";
                }
                // window.location.href = HrefUrl;
                locationHref(HrefUrl);
                setTimeout(function() {
                    if (fn) fn();
                }, 2e3);
            } else if (isiOS) {
                // 在ios的终端
                var HrefUrl = "";
                if (iosUrl && iosUrl != undefined && iosUrl != "") {
                    HrefUrl = "ddjapk://weburl?url=" + iosUrl;
                } else {
                    HrefUrl = "ddjapk://cn.dankal.sf";
                }
                window.location.href = HrefUrl;
                setTimeout(function() {
                    if (fn) fn();
                }, 2e3);
            }
        } else {}
    }
    exports.isHasApp = isHasApp;
    // 获取链接中的指定参数
    function getSearchString(key) {
        var str = window.location.search;
        str = str.substring(1, str.length);
        // 获取URL中?之后的字符（去掉第一位的问号）
        // 以&分隔字符串，获得类似name=xiaoli这样的元素数组
        var arr = str.split("&");
        var obj = new Object();
        // 将每一个数组元素以=分隔并赋给obj对象
        for (var i = 0; i < arr.length; i++) {
            var tmp_arr = arr[i].split("=");
            obj[decodeURIComponent(tmp_arr[0])] = decodeURIComponent(tmp_arr[1]);
        }
        return obj[key];
    }
    exports.getSearchString = getSearchString;
    // 跳转支付宝小程序 根据链接后面的 startAliapp 参数跳转
    function gotoMiniAlipay() {
        var _this = this;
        var startAliapp = getSearchString("startAliapp");
        if (!startAliapp) return;
        if (isWeiXin()) return;
        G_JSON_POST("/m/a/jumpLink/1.0/getJumpLink", {
            jumpLinkId: startAliapp
        }, function(data) {
            var _data = data.data;
            var _ret = data.ret;
            if (_ret.code == "0") {
                if (!_data) return;
                var s = document.createElement("a");
                s.href = _data;
                s.click();
            }
        });
    }
    exports.gotoMiniAlipay = gotoMiniAlipay;
    /**
     * 立即下单统计购买数据上传
     * @param order_sn
     * @param callback
     */
    function uploadCollection(payUrl, one_order_sn, callback) {
        // 立即购买的接口才记录
        if (payUrl !== "/shop/payment/orderPay") {
            return callback && typeof callback == "function" && callback();
        }
        var collectData = "/m/o/order/track/1.0/collectData";
        var sign = "";
        var query = window.location.search;
        query = query && query.trim();
        if (query) {
            query = query && query.split("&").filter(function(item) {
                return item.indexOf("goodMk") !== -1;
            });
            if (query && query[0]) {
                // 获取到的标识：F9VAGD597K1IIW0L
                sign = query[0].replace("goodMk=", "");
            }
        }
        if (one_order_sn && sign) {
            G_JSON_POST(collectData, {
                orderSn: one_order_sn,
                sign: sign
            }, function() {
                callback && typeof callback == "function" && callback();
            }, function() {
                callback && typeof callback == "function" && callback();
            });
        } else {
            callback && typeof callback == "function" && callback();
        }
    }
    exports.uploadCollection = uploadCollection;
});
define("static_v4/js/mod/baiduCount", [], function(require, exports, module) {
    var oBody = $("body");
    function getCookie(name) {
        var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
        if (arr = document.cookie.match(reg)) {
            return unescape(arr[2]);
        } else {
            return null;
        }
    }
    function JudgeSource(ios, and, wxmin, wx, alipay, qq, h5) {
        var u = window.navigator.userAgent;
        //var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
        var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
        //ios终端
        var isWXMini = window.__wxjs_environment == "miniprogram";
        var ua = u.toLowerCase();
        var isWeiXin = ua.match(/MicroMessenger/i) == "micromessenger";
        var isAlipay = ua.match(/AlipayClient/i) == "alipayclient";
        var isQQ = ua.match(/QQ/i) == "qq";
        // 检测室安卓还是ios
        if (u.search("origin/sfddjapp") > 0) {
            if (isIOS) {
                if (ios) ios();
            } else {
                if (and) and();
            }
        } else if (isWXMini) {
            if (wxmin) wxmin();
        } else {
            if (isWeiXin) {
                if (wx) wx();
            } else if (isAlipay) {
                if (alipay) alipay();
            } else if (isQQ) {
                if (qq) qq();
            } else {
                if (h5) h5();
            }
        }
    }
    // 第三方统计的插件
    var TPLMethods = {
        userInfo: JSON.parse(getCookie("ddj-userInfo")),
        // 百度统计
        baidu: function() {
            /**
             *  百度统计
             */
            var sfddjUrl = "9a6219852c6bc360b517de9714e19810";
            //m.sfddj.com
            (function() {
                var hm = document.createElement("script");
                hm.src = "//hm.baidu.com/hm.js?" + sfddjUrl;
                // var s = document.getElementsByTagName("script")[0];
                // s.parentNode.insertBefore(hm, s);
                oBody.append(hm);
            })();
        },
        // gio 统计
        gio: function() {
            var _this = this;
            !function(e, t, n, g, i) {
                e[i] = e[i] || function() {
                    (e[i].q = e[i].q || []).push(arguments);
                }, n = t.createElement("script");
                // tag = t.getElementsByTagName("script")[0];
                // n.async = 1;
                n.src = ("https:" == document.location.protocol ? "https://" : "http://") + g;
                // tag.parentNode.insertBefore(n, tag)
                oBody.append(n);
            }(window, document, "script", "assets.growingio.com/2.1/gio.js", "gio");
            var _gioSetUserId = "";
            if (_this.userInfo) {
                if (_this.userInfo.memberId) {
                    _gioSetUserId = _this.userInfo.memberId;
                } else if (_this.userInfo.openId) {
                    _gioSetUserId = _this.userInfo.openId;
                } else {
                    _gioSetUserId = "";
                }
            }
            gio("init", "b665fa1721dac33b", {});
            // console.log(ddjhoc.userAction)
            // console.log(gio)
            // 给gio 传递用户信息
            gio("setUserId", _gioSetUserId);
            gio("send");
        }
    };
    // ZaneMa Testing
    $.getScript("/static_v4/js/plug/DDJStatistics.js", function(response, status) {
        ddjhoc.init(function() {
            // TPLMethods.baidu();
            TPLMethods.gio();
        });
    });
});